﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PluginXtraZone
{
    public partial class frmCaptchaHandler : Form
    {
        public string CaptchaString { get; private set; }
        public string TokenID { get; private set; }

        public frmCaptchaHandler(string tokenid, string captchaimage)
        {
            InitializeComponent();
            pbCaptcha.ImageLocation = captchaimage;
            CaptchaString = "";
            TokenID = tokenid;
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            Login();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void tbCaptcha_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Login();
            }
        }

        private void Login()
        {
            CaptchaString = this.tbCaptcha.Text;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
